//
//  HomeTabBarController.m
//  HuLaQuan
//
//  Created by hok on 1/20/16.
//  Copyright © 2016 Jianghao. All rights reserved.
//

#import "HomeTabBarController.h"

@interface HomeTabBarController ()

@property (nonatomic, strong) NSArray *items;
@end

@implementation HomeTabBarController


- (NSArray *)items
{
    if(!_items) _items= [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"TabItem" ofType:@"plist"]];
    return _items;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupUI];
    // Do any additional setup after loading the view.
   // self.viewControllers
}
- (void)setupUI
{

    
    UIStoryboard *storyBoard1 = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    UIViewController *controller1 = [storyBoard1 instantiateInitialViewController];
    
    UIStoryboard *storyBoard2 = [UIStoryboard storyboardWithName:@"My" bundle:nil];
    UIViewController *controller2 = [storyBoard2 instantiateInitialViewController];
    
    UIStoryboard *storyBoard3 = [UIStoryboard storyboardWithName:@"Message" bundle:nil];
    UIViewController *controller3 = [storyBoard3 instantiateInitialViewController];
    
    self.viewControllers = @[controller1,controller3,controller2];
    
    for (int i = 0 ; i < [self.tabBar.items count]; i++) {
        
        UITabBarItem *item = self.tabBar.items[i];
       
        item.title = self.items[i][@"title"];
     
         NSString *name= self.items[i][@"imageName"];
        item.image = [[UIImage imageNamed:name] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        item.selectedImage = [[UIImage imageNamed:[name stringByAppendingString:@"_on"]]  imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    }

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
